<!DOCTYPE html>
<html>
<head>
  <script src="../../processing.js"></script>
<link rel="stylesheet" href="../style.css"/></head>
<body><h1><a href="http://ejohn.org/blog/processingjs/">Processing.js</a></h1>
<h2>SaveOneImage</h2>

<p>The save() function allows you to save an image from the 
display window. In this example, save() is run when a mouse
button is pressed. The image "line.tif" is saved to the 
same folder as the sketch's program file.</p>

<p><a href="http://processing.org/learning/topics/saveoneimage.html"><b>Original Processing.org Example:</b> SaveOneImage</a><br>
<script type="application/processing">
void setup() 
{
  size(100, 100);
}

void draw() 
{
  background(204);
  line(0, 0, mouseX, height);
  line(width, 0, 0, mouseY);
}

void mousePressed() 
{
  save("line.tif");
}
</script><canvas width="200" height="200"></canvas></p>
<div style="height:0px;width:0px;overflow:hidden;"></div>

<pre><b>// All Examples Written by <a href="http://reas.com/">Casey Reas</a> and <a href="http://benfry.com/">Ben Fry</a>
// unless otherwise stated.</b>
void setup() 
{
  size(100, 100);
}

void draw() 
{
  background(204);
  line(0, 0, mouseX, height);
  line(width, 0, 0, mouseY);
}

void mousePressed() 
{
  save("line.tif");
}</pre>
</body>
</html>
